package md.frolov.bible.model;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

public class Language implements IStructure,IViewLabelProvider{
	private String id;
	private String name;
	private List<Module> modules = new ArrayList<Module>();
	private Category parent = null;
	
	private Language(){};
	
	public Language(String id){
		this.id = id;
	}
	
	public void addModule(Module m){
		modules.add(m);
		parent = Archive.getInstance().getCategoryByID(m.getCategory());
	}

	@Override
	public Object[] getChildren() {
		return modules.toArray();
	}

	@Override
	public Object getParent() {
		return parent;
	}

	@Override
	public boolean hasChildren() {
		if(modules.size()>0) return true;
		return false;
	}
	
	public String getText(){
		return id;
	}

	@Override
	public String getId() {
		return id;
	}
	
	
}
